package com.uzai.console.web.wechatwork;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.wechatprivate.friendrequest.FriendRequestIdListDto;
import com.uzai.console.dto.wechatprivate.friendrequest.FriendRequestQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.device.DeviceService;
import com.uzai.console.service.wechatprivate.FriendRequestService;
import com.uzai.console.service.wechatwork.WxworkFriendRequestService;
import com.uzai.console.vo.wechatprivate.friendrequest.FriendRequestInfoVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 好友请求
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "企业微信好友请求",tags = "企业微信|好友请求")
@ApiSort(5)
@RestController
public class WxworkFriendRequestController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(WxworkFriendRequestController.class);

    @Autowired
    private WxworkFriendRequestService wxworkFriendRequestService;
    @Autowired
    private DeviceService deviceService;

    @ApiOperation(value = "查询企业微信好友请求列表", notes = "查询企业微信好友请求列表", response = FriendRequestInfoVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/wxworkFriendRequest/findFriendRequestList")
    public Object findFriendRequestList(@RequestBody FriendRequestQuery friendRequestQuery){
        return wxworkFriendRequestService.findFriendRequestList(friendRequestQuery,true);
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkFriendRequest, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除企业微信好友请求", notes = "删除企业微信好友请求", response = Boolean.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/wxworkFriendRequest/deleteFriendRequest")
    public Object deleteFriendRequest(@RequestBody FriendRequestIdListDto friendRequestIdListDto){
        wxworkFriendRequestService.deleteFriendRequest(friendRequestIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkFriendRequest, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "通过企业微信好友请求", notes = "通过企业微信好友请求" , response = Boolean.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/wxworkFriendRequest/addFriendRequest")
    public Object addFriendRequest(@RequestBody FriendRequestIdListDto friendRequestIdListDto){
        wxworkFriendRequestService.addFriendRequest(friendRequestIdListDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.DeviceWxworkFriendRequest, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "忽略企业微信好友请求", notes = "忽略企业微信好友请求" , response = Boolean.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/wxworkFriendRequest/passFriendRequest")
    public Object passFriendRequest(@RequestBody FriendRequestIdListDto friendRequestIdListDto){
        wxworkFriendRequestService.passFriendRequest(friendRequestIdListDto);
        return true;
    }


}
